import os
from threading import Thread

ips = []


def host(start, end):
    lan1 = (range(start, end))
    for ip in lan1:
        ip1 = '202.96.20.%s' % ip
        ips.append(ip1)


def check(host):
    # print(host)
    cmd = 'ping -c 1 %s' % host
    os.system(cmd)


host(1, 11)

for ip in ips:
    # target 为方法，调用哪个方法, args为传入的方法所需要的参数
    t = Thread(target=check, args=(ip,))  # 如果只有一个元组需要后面给一个逗号
    t.start()
